//
//  UIView+HMExtension.m
//  3-15-网易界面（自定义多控制器）
//
//  Created by apple on 15/3/15.
//  Copyright (c) 2015年 itcast. All rights reserved.
//

#import "UIView+HMExtension.h"

@implementation UIView (HMExtension)
/**
 *  实现get方法
 */
-(CGFloat)x
{

    return self.frame.origin.x;
}

-(CGFloat)y
{

    return self.frame.origin.y;
}

-(CGFloat)width
{

    return self.frame.size.width;
}

-(CGFloat)height
{

    return self.frame.size.height;
}

//-(CGPoint)center
//{
//    CGFloat x = self.frame.size.width * 0.5;
//    CGFloat y = self.frame.size.height * 0.5;
//    return CGPointMake(x, y);
//}

/**
 *  实现set方法
 */
-(void)setX:(CGFloat)x
{
    CGRect frame = self.frame;
    frame.origin.x = x;
    self.frame = frame;
    
}

-(void)setY:(CGFloat)y
{
    CGRect frame = self.frame;
    frame.origin.y = y;
    self.frame = frame;
    
}

-(void)setWidth:(CGFloat)width
{
    CGRect frame = self.frame;
    frame.size.width = width;
    self.frame = frame;
}

-(void)setHeight:(CGFloat)height
{
    CGRect frame = self.frame;
    frame.size.height = height;
    self.frame = frame;
}

//-(void)setCenter:(CGPoint)center
//{
//
//    CGPoint newCenter = self.center;
//    newCenter = center;
//    self.center = newCenter;
//}
@end
